﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.Library;
using System.Data;
using IHISCETeim.BLL;

namespace IHISCETeim.Web.MachineSys.ProdModel
{
    public partial class OPDNPayDateEditEasyUI : EasyUIPageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.修改 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "OPDNPayDateEditEasyUI";
            }
        }


        #region 属性 (查询条件)


        protected string QueryValue
        {
            get
            {
                return GetRequestValue<string>("QueryValue", "");

            }
        }
       

        #endregion

        protected string GetSQLWhere()
        {
            string wheresql = "";
            string sqlcommonFiled = "";
            if (!string.IsNullOrEmpty(QueryValue))
            {
                sqlcommonFiled = QueryOperatorsEnumHelper.ConvertCommonOperator("DocNum", QueryOperatorsEnum.等于, QueryValue);
                wheresql = sqlcommonFiled;
            }
            return wheresql;
        }

        protected override string query()
        {
            DataTable dt = SBOController.GetOPDNList(GetSQLWhere(), 30);

            return ToDataGridJson(dt, dt.Rows.Count, null).ToString();
        }


        protected override string editrow()
        {
            int DocEntry = GetRequestValue<int>("DocEntry", 0);
            string payDate = GetRequestValue<string>("U_PayDate","");
            if (payDate == "")
                return "成功";
            bool rv = SBOController.UpdateOPDNPayDate(DocEntry, payDate);
            return rv ? "成功" : "修改失败";
           // return DocEntry.ToString() + payDate;
        }
    }
}